home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #14
/
Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO
/
prog_bas
/
oledsrvr.zip
/
OLESRV3.BAS
< prev
next >
Wrap
BASIC Source File
|
1996-01-03
|
1KB
|
81 lines
Attribute VB_Name = "Module1"
Option Explicit
Private mdb As Database
Public InstanceCount As Integer
Public gcolQueue As New Collection
'----- Compiler constant #testing is set to 0 or -1 in
' Tools/Options/Advanced.
' OPTIONAL: INSERT YOUR PATH HERE.
' If dbpath = "" then app.path will be used.
#If Testing Then
'Const dbpath = "c:\vb4source\oleserver_test3"
Const dbpath = ""
#Else
Const dbpath = ""
#End If
Sub Main()
If App.StartMode = vbSModeStandalone Then
MsgBox "this program only available as an OLE server"
End
End If
End Sub
Sub DBOpen()
If mdb Is Nothing Then
If dbpath = "" Then
Set mdb = OpenDatabase(App.Path & "\server2.mdb")
Else
Set mdb = OpenDatabase(dbpath & "\server2.mdb")
End If
End If
End Sub
Sub DBClose()
If Not mdb Is Nothing Then
mdb.Close
Set mdb = Nothing
End If
End Sub
Function NxtItm() As Long
Dim lngItm As Long
Dim ss As Recordset
Set ss = mdb.OpenRecordset("select NextItem from NextItem", dbOpenDynaset)
If ss.BOF Then
lngItm = 1
ss.AddNew
Else
lngItm = ss!NextItem
ss.Edit
End If
ss!NextItem = lngItm + 1
ss.Update
ss.Close
Set ss = Nothing
NxtItm = lngItm
End Function